package com.ruoyi.web.controller.pc.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.blogs.domain.BsResource;
import com.ruoyi.blogs.service.IBsResourceService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.uuid.IdUtils;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "资源")
@RestController
@RequestMapping("/user/resource")
public class UserResourceController extends BaseController {

    @Autowired
    private IBsResourceService bsResourceService;

    /**
     * 新增资源
     */
    @ApiOperation("新增资源")
    @PostMapping
    public R<Integer> add(@RequestBody BsResource bsResource) {
        bsResource.setId(IdUtils.fastSimpleUUID());
        bsResource.setIsHot(0);
        bsResource.setVisible(0);
        return R.ok(bsResourceService.insertBsResource(bsResource));
    }
}
